package com.example.concurrentprogramming8016.future.completablefuture;

import java.util.Random;
import java.util.concurrent.CompletableFuture;

/**
 * @author liyanhao
 * @Date 2023-01-08 20:52
 */
public class ThenRunDemo {
    public static void main(String[] args) {
        CompletableFuture<Void> completableFuture = CompletableFuture.supplyAsync(() -> {
            int number = new Random().nextInt();
            System.out.println("第一阶段 " + number);
            return number;
        }).thenRun(() -> {
            System.out.println("thenRun 执行");
        });
        System.out.println("最终的执行结果 " + completableFuture.join());

    }
}
